import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JTextField;


public class GUIschnipsel extends JFrame{
	
	
	private JTextField textfield_eingabe;
	private JButton button_load;

	public GUIschnipsel(){
	this.getContentPane().setLayout(null);
	this.initWindow();
	this.addWindowListener(new WindowListener() {
		public void windowClosing(WindowEvent e) {
			System.exit(0);
		}

		public void windowActivated(WindowEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		public void windowClosed(WindowEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		public void windowDeactivated(WindowEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		public void windowDeiconified(WindowEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		public void windowIconified(WindowEvent arg0) {
			// TODO Auto-generated method stub
			
		}

		public void windowOpened(WindowEvent arg0) {
			// TODO Auto-generated method stub
			
		}
	});
	
	}
	protected void initWindow(){
		//Color bg = new Color(2);
		textfield_eingabe = new JTextField();
		button_load = new JButton("load");
		textfield_eingabe.setBounds(10, 10, 380, 25);
		button_load.setBounds(150, 100, 100, 25);
		//textfield_eingabe.setBackground(bg);
		this.getContentPane().add(textfield_eingabe);
		this.getContentPane().add(button_load);
		button_load.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0){
				button_loadClicked();
			}
		});
		this.pack();
		this.setVisible(true);
	}
	
	public void button_loadClicked(){
		String inhalt;
		try {
				inhalt = String.valueOf(textfield_eingabe.getText());
		} catch (NullPointerException e) {
			e.getStackTrace();
			inhalt = null;
		}
		if(inhalt != null) {
			//umschreiben zum load in andere Klasse
			System.out.println(inhalt);
		} else {
			System.out.println("keine / falsche eingabe");
		}
	}
 }
